<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
	<head>
		<style type="text/css">
		.input-lg {
		    height: 46px;
		    padding: 10px 16px;
		    font-size: 18px;
		    line-height: 1.3333333;
		    border-radius: 6px;
		}
		
		.form-control {
		    display: block;
		    width: 93%;
		    height: 34px;
		    padding: 6px 12px;
		    font-size: 14px;
		    line-height: 1.42857143;
		    color: #555;
		    background-color: #fff;
		    background-image: none;
		    border: 1px solid #ccc;
		    border-radius: 6px;
	        margin: 12px 0;
	        font-size: 16px;
		    -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
		    box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
		    -webkit-transition: border-color ease-in-out .15s,-webkit-box-shadow ease-in-out .15s;
		    -o-transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
		    transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
		}
		</style>
	</head>
	<body>
		 <div class="free_play_modal">
		  <div class="inner">
		  <input id="tryPlayAcount" type="text" value="" placeholder="请输入试玩用户名" class="form-control input-lg">
		  <input id="tryPlayPwd" type="password" placeholder="请输入密码" class="form-control input-lg">
		    <p>试玩账号只供玩家熟悉游戏。不允许充值和提款，且不享有参加优惠活动的权利，有效时间为<em>72小时。</em></p>
		    <div class="btn-wrapper">
		      <button id="free_play_no">暂不试玩</button>
		      <button id="free_play_yes">立即试玩</button>
		    </div>
		  </div>
		</div>
	
	
		<div class="zs_box zs_left" >
			  <a class="zs_close" href="javascript:;">关闭</a>
			  <li class="free_play">
				  <a>
				      <i class="iconfont icon-Controller"></i>
				      <span id="free_plays">免费试玩</span>
				   </a>
			  </li>
			  <li class="help_center">
			  	<a  href="/pc/help.do" target="parent">
				    <i class="iconfont icon-bangzhu"></i>
				    <span >帮助中心</span>
			    </a>
			  </li>
			  <a class="qr"><img alt="" src=""></a>
			  <span class="foot">
			        <em class="b">扫一扫</em>
			        <em class="s">安卓 APP下载</em>
			    </span>
			  <a class="zs_top" href="javascript:;"> <i class="go_top"></i> 返回顶部</a>
			</div>
			<div class="zs_box zs_right" >
			  <a class="zs_close" href="javascript:;">关闭</a>
			  <li class="online_sup">
				  <a id="i-online_service-icon-kefu" target="blank">
				  	 <i class="iconfont icon-kefu"></i>
				     <span id="online_service"  >在线客服</span>
				  </a>
			  </li>
			  <li class="line_exa">
				  <a id="qq_service1">
				     <i class="iconfont icon-qqkefu"></i>
				     <span class="qq_service" >QQ客服</span>
				  </a>
			  </li>
			  <a class="qr" href=""><img alt="" src=""></a>
			  <span class="foot">
			            <em class="b">扫一扫</em><em class="s">苹果 APP下载</em>
			        </span>
			  <a class="zs_top" href="javascript:;"> <i class="go_top"></i> 返回顶部</a>
		</div>	
		<script type="text/javascript">
		
		$(function(){
			$('#free_play_yes').on('click',tryPlaying);
		});
		$("#i-online_service-icon-kefu").on("click",function(){
			$.ajax({
			url: "/pc/useronline.do",
			type: "post",
			async:false,
			data: {},
				success: function(data) {
					console.log(data.data)
					if(data.data != null){
						window.open("/pc/kefu.do")
					}else{
						PrentLayerLittle("提示：", "登录以后可联系客服哦")		
					}
				},
				error: function(status) {
					showNormalNoticeModal("#div-i-noticeGenDan", "提示：", "网络繁忙")
				}
			})
		})
		
		$('#free_play_no').on('click',function(){
			$(".free_play_modal").hide();
		});
			
		function tryPlaying(){
			var acount = $('#tryPlayAcount').val();
			var pwd = $('#tryPlayPwd').val();
			$.post('/u/tryplay.do',{name:acount,pass:pwd},function(result){
				if(pwd==""){
					PrentLayerLittle("提示：", "请输入试玩密码")
					return;
				}
				
				if(result.message == 10){
					//已经在登录状态啦
					PrentLayerLittle("提示：", "你已经在登录状态！不可在登录")
					return;
				}
				if(result.message == 3){
					//已经在登录状态啦
					PrentLayerLittle("提示：", "用户名已经存在,请手动更换用户名")
					return;
				}
				if(result.message == 2){
					//已经在登录状态啦
					PrentLayerLittle("提示：", "你ip试玩次数过多，请明天在来吧")
					return;
				}
				window.location.href='/pc/index.do';
			});
		}
		
		$.ajax({
			url: "/pc/commonPage.do",
			type: "post",
			data: {},
			success: function(data) {
				var newData=data.data;
				$(".zs_left .qr img").attr("src","/d/cp/"+newData.android_img)
				$(".zs_right .qr img").attr("src","/d/cp/"+newData.ios_img)
				if($(".home-notice").length==1){
					$(".home-notice").css("background-image","url('/d/cp/"+ newData.pc_img+"')")
				}
			},
			error: function(status) {
				showNormalNoticeModal("#div-i-noticeGenDan", "提示：", "网络繁忙")
			}
		})
		
		$('.zs_close').on('click',function(){  //关闭两侧栏
			$('.zs_left').hide();
			$('.zs_right').hide();
		})
		
		
		$(".zs_top").click(function() {   //返回顶部
				return $("html").scrollTop() ? ($("html").animate({
					scrollTop: 0
				}, 800), !1) : ($("body").animate({
					scrollTop: 0
				}, 800), !1)
			});
		
		$('.free_play').on('click',function(){
			$.post('/u/tryPlayAcount.do',{},function(result){
				$('#tryPlayAcount').val(result.data);
			});
			$(".free_play_modal")[0].style.display="flex"
		})
		
		$("#header").load(function(){   //头部加载完成
			var frame=$("#header").prop("contentWindow").document;
			console.log(frame)
			$.post('/kfurl.do',{},function(result){
				$('#qq_service1').attr('href','tencent://message/?uin='+result.data[0].number+'amp;Site=web&amp;Menu=yes&#39');
				if($(frame).find("#qq_service").length==1){
					$(frame).find("#qq_service").attr('href','tencent://message/?uin='+result.data[0].number+'amp;Site=web&amp;Menu=yes&#39');
				}
			});
			$(frame).find("#free_play").on("click",function(event){
				$.post('/u/tryPlayAcount.do',{},function(result){
					$('#tryPlayAcount').val(result.data);
				});
				$(".free_play_modal")[0].style.display="flex"
			})
			$(".free_play_modal").on("click",".close",function(){
				$(".free_play_modal")[0].style.display="none"
			})
			
			$(".free_play_modal").on("click","#free_play_no",function(){
				$(".free_play_modal")[0].style.display="none"
			})
			
			$(".free_play_modal").on("click","#free_play_yes",function(){
				$(".free_play_modal")[0].style.display="none"
			})
		})
		</script>
	</body>
</html>